package com.arrogames.rgblabyrinth.menu {
	import com.arrogames.rgblabyrinth.AssetManager;
	import com.arrogames.util.UIUtil;
	
	import feathers.controls.Screen;
	
	import starling.display.DisplayObject;
	import starling.display.Image;
	import starling.events.Event;
	import starling.textures.Texture;
	
	public class MainMenuScreen extends Screen {
		public function MainMenuScreen() {
			super();
		}
		
		override protected function initialize():void {
			super.initialize();
			
			addChild(createLogo());
			
			addChild(UIUtil.createButton(AssetManager.instance.getTexture("newgameBtn"), (600/2)-10, 330, onNewClick));
			addChild(UIUtil.createButton(AssetManager.instance.getTexture("continueBtn"), (600/2)+128, 330, onContinueClick));
		}
		
		private function createLogo():DisplayObject {
			var texture:Texture = AssetManager.instance.getTexture("logo");
			return new Image(texture);
		}
		
		private function onContinueClick(event:Event):void {
			owner.showScreen(RGBNavigator.CONTINUEGAME);
		}
		
		private function onNewClick(event:Event):void {
			this.owner.showScreen(RGBNavigator.NEWGAME);
		}
	}
}